<template>
  <div>
    <router-view/>
  </div>
</template>

<script setup lang="ts">
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import {useThemeStore} from '@/stores/theme'
import {onBeforeMount} from 'vue'

const themeStore = useThemeStore()

onBeforeMount(() => {
  // 从localStorage获取主题色并初始化
  const savedColor = localStorage.getItem('theme-primary-color')
  if (savedColor) {
    themeStore.setPrimaryColor(savedColor)
  } else {
    // 如果没有保存的主题色，使用默认值
    themeStore.setPrimaryColor(themeStore.primaryColor)
  }
})
</script>

<style>
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

#app {
  height: 100%;
}
</style>